from libs.yuntongxun.sms import CCP
from celery_mall.main import celery_app
from verifications import constants

@celery_app.task(name='ccp_send_sms_code') #只有用此装饰器装饰的函数selery才能识别
def ccp_send_sms_code(self, mobile, sms_code):
    """
    发送短信异步任务
    :param mobile: 手机号
    :param sms_code: 短信验证码
    :return: 成功0 或 失败-1
    """

    send_ret = CCP().send_template_sms(mobile, [sms_code, constants.SMS_CODE_EXPIRE_SERVER], 1)

    return send_ret